<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/template/common/taglibs.jspf" %>
<es:contentHeader/>

<t:base type="jquery,jquery-ui-bootstrap:bootstrap,jquery-ui-bootstrap:jquery-ui,query-ui-bootstrap:jquery.layout,jquery-ui-bootstrap:font-awesome"></t:base>
<t:base type="jquery-ui-bootstrap:jquery.blockUI,jquery-ui-bootstrap:bootstrap.file-input,bootstrap-datetimepicker,nicescroll,jqueryValidate,application,common,datePicker"></t:base>


<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/plug-in/bootstrap/css/bootstrap.min.css">


<style type="text/css">
    .error {
        color: red;
    }
</style>

<form id="editForm" method="post">


    <table class="table table-bordered " style="background-color: whitesmoke">

        <tr>
            <th colspan="6">
                提单信息栏
            </th>
        </tr>
        <tr>
            <th>提单号</th>
            <td>${bookingContainer.billOfLadingCode}</td>
            <th>截港日期</th>
            <td>
                <fmt:formatDate value="${bookingContainer.confirmBillDate}" pattern="yyyy-MM-dd"/>
            </td>
            <th>截港日期</th>
            <td><fmt:formatDate value="${bookingContainer.finalCustoms}" pattern="yyyy-MM-dd"/></td>
        </tr>


        <tr>
            <th>实际船期</th>
            <td><fmt:formatDate value="${bookingContainer.shipDate}" pattern="yyyy-MM-dd"/></td>
            <th>销售订单号</th>
            <td>${bookingContainer.saleOrderCode}</td>
            <th>客户名称</th>
            <td>${saleOrderHeader.custfullname}</td>
        </tr>

        <tr>
            <th>业务员</th>
            <td>${saleOrderHeader.salemanname}</td>
            <th>目的港</th>
            <td>${saleOrderHeader.destport}</td>
            <th>包装要求</th>
            <td>${saleOrderHeader.packing}</td>
        </tr>

        <tr>
            <th>备注</th>
            <td colspan="5">
                ${bookingContainer.remark}
            </td>
        </tr>

        <tr>
            <th>装车日期</th>
            <td><input type="text" name="carryDate" onclick="wdate()"></td>
            <input type="hidden" name="saleordercode" value="${bookingContainer.saleOrderCode}">
            <input type="hidden" name="bookingContainerId" value="${bookingContainer.id}">
        </tr>
    </table>


    <div style="clear: both"></div>

    <div class="table-responsive">
        <table class="table table-bordered table-hover" style="white-space: nowrap">
            <thead>
            <tr>
                <th colspan="14">商品装箱信息栏</th>
            </tr>
            <tr>
                <th>订单号</th>
                <th>产品编码</th>
                <th>品牌</th>
                <th>规格描述</th>
                <th>装箱量</th>
                <th>派车箱量</th>
                <th>申请数量</th>
                <th>剩余数量</th>
                <th>可用库存</th>
                <th>分箱数量</th>
                <th>填箱规格</th>
                <th>甩箱规格</th>
                <th>标签</th>
                <th>备注</th>
            </tr>
            </thead>

            <c:forEach items="${saleOrderItems}" var="m">
                <tr>

                    <td>
                        ${m.saleordercode}
                    </td>
                    <td><input type="text" name="saleorderitemcode" value="${m.saleorderitemcode}" readonly="readonly">
                    </td>
                    <td>${m.brand}</td>
                    <td>${m.standard}</td>
                    <td>${m.packingqty}</td>
                    <td>${m.containerqty}</td>

                    <td>${m.planquty}</td>
                    <td>${hasNotDeliverCount[m.saleorderitemcode]}</td>
                    <td>可用库存</td>
                    <td><input type="text" name="packingQty"></td>
                    <th>${m.fillsigna}</th>
                    <th>${m.fillsignb}</th>
                    <th>标签</th>
                    <th>${m.contractremark}</th>


                </tr>
            </c:forEach>
        </table>
    </div>

    <div class="control-group left-group">
        <div>
            <button type="submit" id="sub" class="btn btn-primary">
                <i class="${icon}"></i>
                ${op}
            </button>
            <a href="javascript:self.location=document.referrer;" class="btn">
                <i class="icon-reply"></i>
                返回
            </a>(该订单已经制定了${markedDeliverCount}个发货单，总共${bookingContainer.containerCount_HQ+bookingContainer.containerCount_EQ}个)
        </div>
    </div>

</form>


<es:contentFooter/>


<script type="text/javascript">


    $(function () {
        $("#editForm").validate({
            rules: {
                packingQty: {
                    required: true
                },
                carryDate: {
                    required: true
                }
            },
            messages: {
                packingQty: {
                    required: "请输入分箱数量"
                },
                carryDate: {
                    required: "请输入装车日期"
                }
            }
        });

        $("#editForm").submit(function () {
            var flag = $("#editForm").valid();
            if (!flag) {
                return false;
            }
        });
    });

</script>